#Illustration of some S-Plus features #Notions: object, slots, extractors, etc. # #Also illustration of a function to get returns #Plotting of Returns module(finmetrics) #We load the finmetrics module which has a data set in it called singleIndex.dat #We'll use S tools to look at this data set. #First we'll see what kind of object it is, then look at its "slots" then #do some basic manipulations... ploting, getting returns, plotting returns. class(singleIndex.dat) slotNames(singleIndex.dat) singleIndex.dat@title singleIndex.dat@units singleIndex.dat@documentation singleIndex.dat[1:5,] positions(singleIndex.dat)[1:5] class(positions(singleIndex.dat)) singleIndex.dat@data[1:5,] seriesData(singleIndex.dat)[1:5,] colIds(singleIndex.dat) #Now Basic Manipulations msft.p=singleIndex.dat[, "MSFT"] colIds(singleIndex.dat) #Tools for Returns #See discussion p. 43-48 of ZW args(getReturns) msft.ret=getReturns(msft.p,percentage=T) plot(msft.ret)